package y_2025.m03.d21.t03;


public class Student {
    // 学号
    private String id;
    // 姓名
    private String name;
    // 性别
    private String gender;
    // 年龄
    private int age;
    // 平均成绩
    private double avgScore;


    //  构造方法
    public Student(String id, String name, String gender, int age, double avgScore) {
        this.id = id;
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.avgScore = avgScore;
    }

    // 用set和get方法来获取和修改属性
    public String getId() { return id; }
    public void setId(String id) { this.id = id; }

    public String getName() { return name; }
    public void setName(String name) { this.name = name; }

    public String getGender() { return gender; }
    public void setGender(String gender) { this.gender = gender; }

    public int getAge() { return age; }
    public void setAge(int age) { this.age = age; }

    public double getAvgScore() { return avgScore; }
    public void setAvgScore(double avgScore) { this.avgScore = avgScore; }

    public void print() {
        System.out.println("学号: " + id);
        System.out.println("姓名: " + name);
        System.out.println("性别: " + gender);
        System.out.println("年龄: " + age);
        System.out.println("平均成绩: " + avgScore);
    }

    public static void main(String[] args) {
        Student s1 = new Student("2023001", "王小明", "男", 20, 88.5);
        Student s2 = new Student("2023002", "李小红", "女", 19, 92.0);

        System.out.println("学生1信息:");
        s1.print();
        System.out.println("\n学生2信息:");
        s2.print();
    }
}